<!--合伙|代理的特殊区域-->
<meta charset="utf-8"/>
<div class="row">
  <div class="col-xs-12">
    <div class="row">
      <div class="col-xs-12">
        <div style="height:36px;margin-top:2px">
          <table class="no-border" style="display:inline">
            <tr>
              <td permission='area_proxy_btn_listData' style="padding-right:6px;display:none">
                行政区域名称
              </td>
              <td permission='area_proxy_btn_listData' style="display:none">
                <input type="text" id="key_area_name" class="form-control search-query" placeholder="行政区域名称" title="输入行政区域名称" style="width:256px"/>
              </td>
              <td permission='area_proxy_btn_listData' style="display:none">
                <div class="input-group">
                  <span class="input-group-btn"><button type="button" class="btn btn-inverse btn-white" id="btnSearch" title="搜索查询"><span class="ace-icon fa fa-search bigger-110"></span>搜索</button></span>
                </div>
              </td>
              <td permission='area_proxy_btn_listData' style="display:none" class="hidden-480">
                <div class="input-group">
                  <span class="input-group-btn"><button type="button" class="btn btn-inverse btn-white" id="btnReset" title="重置清空搜索关键字"><span class="ace-icon fa fa-undo bigger-110"></span>重置</button></span>
                </div>
              </td>
            </tr>
          </table>
          <div class="hidden-480 pull-right tableTools-container" permission='area_proxy_btn_listData' style="display:none;margin-bottom:2px"></div>
        </div>
        <table id="tableListPartnerArea" class="table table-striped table-bordered table-hover">
          <tbody>
          <tr>
            <td style="text-align:center;height:37px">正在加载……</td>
          </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>
<div id="divKeyColumns" style="display:none;padding:1px 0px;"></div>
<div style="display:none;">
  <input type="hidden" id="area_proxy_btn_listData"/>
  <input type="hidden" id="area_proxy_btn_add"/>
  <input type="hidden" id="area_proxy_row_edit"/>
  <input type="hidden" id="area_proxy_row_queryById"/>
  <input type="hidden" id="area_proxy_row_delById"/>
  <input type="hidden" id="area_proxy_btn_listUser"/>
  <input type="hidden" id="area_proxy_row_addUser"/>
</div>
<div id="div_batch_tree" style="display:none;padding-top:2px">
  <ul id="ulBatchTree" class="ztree">
    <li><span>正在加载……</span></li>
  </ul>
</div>
<div id="div_chosen_select" style="display:none;padding-top:2px">
  <form class="form-horizontal" id="form_partner_area_edit" role="form">
    <label class="col-sm-3 control-label no-padding-right"><div class="hr-4">用户账号<span style="color:#f00;display:inline-block;vertical-align:middle;width:auto;height:14px;line-height:18px">*</span></div></label>
    <div class="col-sm-8">
      <div class="hr-4"></div>
      <select class="chosen-select" id="form_chosen_select" data-placeholder="请选择……">
        <option value=""></option>
        <option value="">请输入关键字搜索</option>
      </select>
    </div>
    <label class="col-sm-3 control-label no-padding-right"><div class="hr-4">真实姓名<span style="color:#f00;display:inline-block;vertical-align:middle;width:auto;height:14px;line-height:18px">*</span></div></label>
    <div class="col-sm-8">
      <div class="hr-4"></div>
      <input type="text" id="real_name" placeholder="真实姓名" class="form-control" maxlength="20" title="真实姓名"/>
    </div>
    <label class="col-sm-3 control-label no-padding-right"><div class="hr-4">身份证号<span style="color:#f00;display:inline-block;vertical-align:middle;width:auto;height:14px;line-height:18px">*</span></div></label>
    <div class="col-sm-8">
      <div class="hr-4"></div>
      <input type="text" id="id_card" placeholder="身份证号码" class="form-control" maxlength="20" title="身份证号"/>
    </div>
    <label class="col-sm-3 control-label no-padding-right"><div class="hr-4">联系电话<span style="color:#f00;display:inline-block;vertical-align:middle;width:auto;height:14px;line-height:18px">*</span></div></label>
    <div class="col-sm-8">
      <div class="hr-4"></div>
      <input type="text" id="phone" placeholder="联系电话" class="form-control" maxlength="20" title="联系电话"/>
    </div>
    <label class="col-sm-3 control-label no-padding-right"><div class="hr-4" id="proxyArea">代理住址<span style="display:inline-block;width:8px"></span></div></label>
    <div class="col-sm-8" style="margin-bottom:6px">
      <div class="hr-4"></div>
      <div id="div_proxy_area" style="margin-bottom:-4px">
        <div class="input-group clsProvince" style="display:none">
          <span class="input-group-btn">
            <button data-toggle="dropdown" class="btn btn-primary btn-white dropdown-toggle col-sm-12" style="margin-left:0.01em">
              <span class="spanText">选择省市</span>
              <i class="ace-icon fa fa-angle-down icon-on-right"></i>
            </button>
            <ul class="dropdown-menu col-sm-12" style="margin-left:-1px"></ul>
          </span>
        </div>
        <div class="input-group clsCity" style="display:none">
          <span class="input-group-btn">
            <button data-toggle="dropdown" class="btn btn-primary btn-white dropdown-toggle col-sm-12" style="margin-left:0.01em">
              <span class="spanText">选择地州市</span>
              <i class="ace-icon fa fa-angle-down icon-on-right"></i>
            </button>
            <ul class="dropdown-menu col-sm-12" style="margin-left:-1px"></ul>
          </span>
        </div>
        <div class="input-group clsCounty" style="display:none">
          <span class="input-group-btn">
            <button data-toggle="dropdown" class="btn btn-primary btn-white dropdown-toggle col-sm-12" style="margin-left:0.01em">
              <span class="spanText">选择区|县</span>
              <i class="ace-icon fa fa-angle-down icon-on-right"></i>
            </button>
            <ul class="dropdown-menu col-sm-12" style="margin-left:-1px"></ul>
          </span>
        </div>
      </div>
    </div>
  </form>
</div>
<div id="div_sys_area_proxy" style="display:none;padding-top:2px;">
  <form class="form-horizontal" id="form_area_proxy" role="form">
    <label class="col-sm-3 control-label no-padding-right"><div class="hr-4"></div>佣金优惠券</label>
    <div class="col-sm-8">
      <div class="hr-4"></div>
      <div class="input-group">
        <span class="input-group-btn">
          <button data-toggle="dropdown" class="btn btn-primary btn-white dropdown-toggle col-sm-12" style="margin-left:0px;">
            <span id="dropdownLabelProxy">选择选项</span>
            <i class="ace-icon fa fa-angle-down"></i>
          </button>
          <ul class="dropdown-menu col-sm-12">
            <li>
              <a id="level_value_" href="javascript:winFn.dropdown('#level_value','','#dropdownLabelProxy','选择选项');">选择选项</a>
            </li>
            <!--<li>
              <a id="level_value1" href="javascript:winFn.dropdown('#level_value',1,'#dropdownLabelProxy','省分公司');">省分公司</a>
            </li>-->
            <li>
              <a id="level_value2" href="javascript:winFn.dropdown('#level_value',2,'#dropdownLabelProxy','市分公司');">市分公司</a>
            </li>
            <li>
              <a id="level_value3" href="javascript:winFn.dropdown('#level_value',3,'#dropdownLabelProxy','区县代理');">区县代理</a>
            </li>
            <!--<li>
              <a id="level_value4" href="javascript:winFn.dropdown('#level_value',4,'#dropdownLabelProxy','直营门店');">直营门店</a>
            </li>
            <li>
              <a id="level_value5" href="javascript:winFn.dropdown('#level_value',5,'#dropdownLabelProxy','推荐人');">推荐人</a>
            </li>-->
          </ul>
          <input id="level_value" type="hidden"/>
        </span>
      </div>
    </div>
  </form>
</div>
<script type="text/javascript">
  ;(function($){
    var tableDom = '#tableListPartnerArea';
    var urlRoute = '/partnerArea/';/*请求controller层的url*/
    var getList = urlRoute + 'listData';/*获取数据列表*/
    var urlEdit = urlRoute + 'edit';/*编辑*/
    var urlDelById = urlRoute + 'delById';/*根据id删除对应的数据*/
    var urlUserList = urlRoute + 'getUserList';/*搜索用户用于绑定*/
    var urlUserAdd = urlRoute + 'addUser';/*区域绑定用户*/
    var urlGetListArea = urlRoute + 'getListArea';/*获取区域信息*/
    var batchTreeObj = null;
    var batchTreeDom = '#ulBatchTree';
    var batchTreeConfig = {
      view : zTreeOpts.view(),
      check : {
        enable: true,
        chkStyle: "checkbox",
        chkboxType: { "Y":"","N": ""}
      },
      data : zTreeOpts.data(),
      async : zTreeOpts.async({
        url : '/partnerArea/getPartner_areaList',//此url可以动态赋值,batchTreeConfig.async.url = urlPrefix + '/partnerArea/getPartner_areaList';在初始化之前赋值
        method : 'GET',
        tips : true
      }),
      callback : {
        beforeAsync : function(treeId,node){
          if(node == undefined){
            self.layerIndex = layerFn.loading('正在处理……');
          }
        },
        onAsyncSuccess : function(event,treeId,node,data){
          if(node == undefined){
            layerFn.closeIndex(self.layerIndex);
            thisPage.batchHandler();
          }
        },
        onAsyncError : function(event,treeId,node){
          if(node == undefined){}//此时ztree节点尚未生成
          layerFn.alert('连接服务器失败',AppKey.code.code199);
        },
        beforeClick : function(treeId,node,clickFlag){
          return false;//true时点击选中文本
        }
      }
    };
    var stateOriginal = {};//仅供参考，更新优化-选项1,可参考项目law-frontend的页面serviceAd.html和后端law-backend的ServiceADService.java;记录编辑的值,仅在编辑时可用
    var thisTable = null;
    var jsonArea = "{\"clsProvince\":\"选择省市\",\"clsCity\":\"选择地州市\",\"clsCounty\":\"选择区|县\",\"cease\":\"clsCounty\"}";
    thisPage = {
      init : function(){
        this.initTable();
        thisPage.createDropdown();
        this.initDom();
        this.addEvent();
      },
      initDom : function(){
        self.chosenUId = winFn.initChosen(urlUserList,'form_chosen_select',function(value,attrs){});//参考项目 yssc-console/src/main/resources/static/salesRepsManage.html
      },
      createDropdown: function(){},
      addEvent: function(){
        $('#btnAdd').on('click', function(){
          thisPage.edit();
        });
        //搜索按钮
        $('#btnSearch').on('click', function(){
          thisPage.search();
        });
        //带复选框的批量操作
        $('#btnBatch').on('click', function(){
          var result = thisPage.getBatchIds();
          if(result != null){
            batchTreeObj = $.fn.zTree.init($(batchTreeDom),batchTreeConfig);
          }
        });
        //重置按钮
        $('#btnReset').on('click', function(){
          $('#key_area_name').val('');
        });
        //按钮组-自定义显示列
        $('#iconColumn').parent().parent().on('click', function(){
          pageDataTable.columnCustom(thisTable, tableDom,'#divKeyColumns');
        });
        //按钮组-搜索
        $('#iconRefresh').parent().parent().on('click', function(){
          thisPage.search();
        });
      },
      /**获取已选中的主键集合,用法:var kids = thisPage.getKeyIds();if(kids == null){layerFn.alert('请选择要操作的数据', AppKey.code.code199);return;}*/
      getKeyIds : function(){
        var arrays = thisTable.rows({selected : true}).data();//获取已勾选的数据行
        if(arrays.length == 0){
          return null;
        }
        var kids = '';
        for(var i = 0; i < arrays.length; i++){
          var value = arrays[i].area_id;
          if(value != ''){
            if(kids.length > 0) kids += ",";
            kids += value;
          }
        }
        return kids;
      },
      getBatchIds : function(){
        var kids = thisPage.getKeyIds();
        if(kids == null){
          layerFn.alert('请选择要操作的数据',AppKey.code.code199);
          return null;
        }
        return kids;
      },
      batchHandler : function(){
        var zIndexLayer = layerFn.addOrEdit('批量操作内容','#div_batch_tree',['510px','450px'],function(layerIndex){
          var nodes = batchTreeObj.getCheckedNodes(true);
          if(nodes.length == 0){
            layerFn.alert('请选择要操作的目标内容',AppKey.code.code199);
            return;
          }
          for(var x=0;x<nodes.length;x++){
            var node = nodes[x];
            if(node.isParent){
              layerFn.alert('['+node.name+']不是有效的目标内容',AppKey.code.code199);
              return;
            }
          }
          var ids = '';
          for(var i=0;i<nodes.length;i++){
            var obj = nodes[i];
            if(ids != ''){
              ids = ids + "," + obj.kid;
            }else{
              ids = obj.kid;
            }
          }
          var kids = thisPage.getBatchIds();
          if(kids == null){
            layerFn.alert('请选择要操作的数据',AppKey.code.code199);
            return;
          }
          var params = {
            ids : ids,
            kids : kids
          };
          layerFn.submit('/partnerArea/updatePartner_areas',params,function(data){
            thisPage.complete(data,layerIndex,true);
          });
        });
        $('#layui-layer' + zIndexLayer + ' a.layui-layer-btn0').text('批量操作');
      },
      initTable : function(){
        var optsVisible = getOptsVisible('area_proxy_row');//确定是否要显示操作选项,若是多个按钮权限时以逗号,隔开
        var aoColumns = [];
        aoColumns.push({
          data : "name",
          sortable : false,
          title : "行政区域名称"
        });
        aoColumns.push({
          data : "pName",
          sortable : false,
          title : "所属区域"
        });
        aoColumns.push({
          data : "inviter",
          sortable : false,
          title : "邀请人账号"
        });
        aoColumns.push({
          data : "level_value",
          sortable : false,
          title : "享受级别",
          sWidth: "110px",
          render : function(value,type,row,meta){
            switch (value){
              case 1:
                return "省分公司";
              case 2:
                return "市分公司";
              case 3:
                return "区县代理";
              case 4:
                return "直营门店";
              case 5:
                return "推荐人";
              default:
                return "其他";
            }
          }
        });
        aoColumns.push({
          data : "deleted",
          sortable : false,
          title : "启用状态",
          sWidth: "100px",
          render : function(value,type,row,meta){
            switch (value){
              case 0:
                return "启用";
              case 1:
                return "禁用";
              default:
                return "";
            }
          }
        });
        if(optsVisible){
          aoColumns.push({
            data : "_area_id_",
            width : "105px",
            title : "<label style='color:#000;margin-left:6px;' title='单行操作'>操作选项</label>",/*此处的字‘操作选项’请勿修改,此处的文字还有其它用途*/
            sortable : false
          });
        }
        var columnDefs = [];
        if(optsVisible){//是否来显示某列
          columnDefs.push({
            targets : -1,
            render : function(value,type,row,meta){
              return "<a title='编辑|修改' href='javascript:thisPage.rowEdit("+ meta.row +");' style='outline:none;text-decoration:none;color:#3b8cff;margin-left:4px;display:none' permission='area_proxy_row_edit'>编辑</a>" +
                "<a title='删除当前行数据' class='hidden-480' href='javascript:thisPage.rowDel("+ meta.row +");' style='outline:none;text-decoration:none;color:#f00;margin-left:6px;display:none' permission='area_proxy_row_delById'>"+(row.deleted == 1 ? '启用' :'禁用')+"</a>" +
                "<a title='绑定代理账号' class='hidden-480' href='javascript:"+(row.deleted == 1 ? '' : 'thisPage.rowBinding(\"'+meta.row+'\")')+";' style='outline:none;text-decoration:none;color:#5b97fb;margin-left:6px;display:none"+(row.deleted == 1 ? ';cursor:not-allowed' : '')+"' permission='area_proxy_btn_listUser'>绑定</a>";
            }
          });
        }
        columnDefs.push({
          targets : [0,1,2,3],
          render : function(value,type,row,meta){
            return pageDataTable.formatColumn(value);
          }
        });
        columnDefs.push({
          visible : false,//列的隐藏显示
          targets : []//指定列索引
        });
        thisTable = pageDataTable.initDataTable({
          tableDom : tableDom,
          sAjaxSource : getList,
          fnServerParams : function(params){
            params.push(
              {"name":"area_name","value":winFn.getDomValue('#key_area_name')}
            );
          },
          aoColumns : aoColumns,
          columnDefs : columnDefs,
          complete : function(settings,data){},//仅执行一次
          footer : function(data,start,end,thLength){},//每次都会执行
          selected : function(selected){
            if(selected){
              //$('#btnDel').removeAttr('disabled');//默认在该button添加属性disabled="disabled"
            }else{
              //$('#btnDel').attr('disabled','disabled');
            }
          }
        });
        pageDataTable.buttons(thisTable);
        pageDataTable.action(thisTable);
        pageDataTable.select(thisTable, tableDom);
        pageDataTable.tooltip();
        $('.dataTables_scroll .dataTables_scrollBody').removeAttr('style');//解决dataTable表头下拉框被tbody遮挡
      },
      search : function(){
        if(verifyFn.inputCheck('#area_proxy_btn_listData','没有操作权限')) return;
        thisTable.draw();
      },
      //需要时或为空时才去请求,减轻服务器查询,仅适用于不需要分页的数据,用法:thisPage.getPartner_areas(function(list){});参考项目 wine-frontend/src/main/resources/static/activity.html的getGoods方法
      getPartner_areas : function(callback){
        if(listPartner_area == null){//定义全局的 var listPartner_area = null;//新增或编辑时所需的数据
          layerFn.queryGetHint(urlQueryPartner_area,{},function(data){
            if(AppKey.code.code200 == data.code){
              listPartner_area = data.data;
              callback(listPartner_area);
            }
          });
        }else{
          callback(listPartner_area);
        }
      },
      resetForm: function(){
        winFn.clearFormData('#form_partner_area_edit');
      },
      //移除不需要对比的key(此方法可有可无)
      editJson : function(data,keys){
        if(keys){
          for(var h = 0; h < keys.length; h++){
            delete data[keys[h]];//删除key元素
          }
        }
        stateOriginal = data;
      },
      //对比是否已修改了值,仅需判断必填的字段，文件上传的字段单独处理
      filterValue : function(params){
        if(stateOriginal != null){
          var ignoreKeys = '';
          var requiredKeys = '';
          for(var so in stateOriginal){
            if(params[so] == stateOriginal[so]){
              delete params[so];
              if(ignoreKeys != ''){
                ignoreKeys += ','+so;
              }else{
                ignoreKeys += so;
              }
            }else{
              if(requiredKeys != ''){
                requiredKeys += ','+so;
              }else{
                requiredKeys += so;
              }
            }
          }
          if(ignoreKeys != ''){
            params['ignoreKeys'] = ignoreKeys;//记录后端忽略验证的key以,隔开的字符串,注意数据库字段是否允许为空,可参考项目law-backend的joins.html;law-backend的JoinsService的方法edit();
          }
          if(requiredKeys != ''){
            params['requiredKeys'] = requiredKeys;//记录后端必填验证的key以,隔开的字符串
          }
        }
      },
      rowEdit : function(rowIndex){
        if(verifyFn.inputRequired('#area_proxy_row_edit')){
          layerFn.alert('没有操作权限',AppKey.code.code199);
          return;
        }
        var row = thisTable.row(rowIndex).data();
        layerFn.addOrEdit('['+row.name+']设置代理佣金优惠券','#div_sys_area_proxy',['380px','310px'],function(layerIndex){
          if(verifyFn.inputRequired('#level_value')){
            layerFn.alert('请选择选项',AppKey.code.code199);
            return;
          }
          var params = {
            areaId : row.area_id,
            level : winFn.getDomValue('#level_value')
          };
          layerFn.submit(urlEdit,params,function(data){
            thisPage.complete(data,layerIndex,true);
          });
        });
        winFn.clearFormData('#form_area_proxy',[{'dropdownLabelProxy':'选择选项'}]);
        var levelValue = row.level_value;
        if(levelValue){
          winFn.editDropdown('#dropdownLabelProxy','level_value'+levelValue);
          winFn.dropdown('#level_value',levelValue);
        }
      },
      rowDel : function(rowIndex){
        if(verifyFn.inputCheck('#area_proxy_row_delById','没有操作权限')) return;
        var row = thisTable.row(rowIndex).data();
        var enabled = row.deleted;
        var msg = '禁用';
        var disable = 1;
        if(enabled == 1){
          msg = '启用';
          disable = 0;
        }
        layerFn.confirm('是否要对账号'+'<span style="color:#1e9fff">'+row.name+'</span>进行<span style="color:#1e9fff">'+msg+'</span>操作吗？',function(){
          layerFn.submit(urlDelById,{areaId:row.area_id,disable:disable,kid:row.kid},function(data){
            thisPage.complete(data,null,true);
          });
        });
      },
      rowBinding : function(rowIndex){
        if(verifyFn.inputCheck('#area_proxy_btn_listUser','没有操作权限')) return;//查询的权限
        if(verifyFn.inputCheck('#area_proxy_row_addUser','没有操作权限')) return;//保存的权限
        var row = thisTable.row(rowIndex).data();
        if(row.deleted == 1){
          layerFn.alert('当前区域已禁用,不支持绑定',AppKey.code.code199);
          return;
        }
        if(row.kid == null || row.kid == undefined){//编辑时必填
          $('#proxyArea').html('代理住址<span style="color:#f00;display:inline-block;vertical-align:middle;width:auto;height:14px;line-height:18px">*</span>');
        }else{
          $('#proxyArea').html('代理住址<span style="display:inline-block;width:8px"></span>');
        }
        //先请求区域代理数据
        layerFn.queryGetHintResult(urlGetListArea,{},function(data){
          pulldownArea.initOpts(urlGetListArea,data,'#div_proxy_area','clsProvince',jsonArea);
          if(AppKey.code.code200 == data.code){
            //再显示表单
            layerFn.addOrEdit('绑定区域代理','#div_chosen_select',['470px','398px'],function(layerIndex){
              var userId = self.chosenUId.val();
              if(userId == null || userId == ''){
                layerFn.alert('请选择绑定代理人员的用户账号',AppKey.code.code199);
                return;
              }
              if(verifyFn.inputEmpty('#real_name')) return;
              if(verifyFn.inputEmpty('#id_card')) return;
              if(verifyFn.inputEmpty('#phone')) return;
              var province_id = winFn.getDomValue('#div_proxy_area .clsProvince input',true);
              var province_name = $('#div_proxy_area .clsProvince span.spanText').text();
              var city_id = winFn.getDomValue('#div_proxy_area .clsCity input',true);
              var city_name = $('#div_proxy_area .clsCity span.spanText').text();
              var county_id = winFn.getDomValue('#div_proxy_area .clsCounty input',true);
              var county_name = $('#div_proxy_area .clsCounty span.spanText').text();
              if(province_id == null){
                layerFn.alertCallback('请选择代理所在省|市',function(){});
                return;
              }
              if(city_id == null){
                layerFn.alertCallback('请选择代理所在地州市',function(){});
                return;
              }
              if(county_id == null){
                layerFn.alertCallback('请选择代理所在区|县',function(){});
                return;
              }
              var params = {
                area_id : row.area_id,
                level : row.level_value,
                user_id : userId,
                province_id : province_id,
                province_name : province_id != null ? province_name : null,
                city_id : city_id,
                city_name : city_id != null ? city_name : null,
                county_id : county_id,
                county_name : county_id != null ? county_name : null,
                real_name : winFn.getDomValue('#real_name',true),
                id_card : winFn.getDomValue('#id_card',true),
                phone : winFn.getDomValue('#phone',true),
                kId : row.kid
              }
              layerFn.submitResult(urlUserAdd,params,function(data){
                switch (data.code){
                  case AppKey.code.code200:
                    thisPage.complete(data,layerIndex,true);
                    break;
                  case AppKey.code.code199:
                    layerFn.alert(data.msg,data.code);
                    break;
                  case AppKey.code.code198:
                    layerFn.alert('当前选择的区域已存在代理',data.code);
                    layerFn.confirm('当前选择的区域已存在代理了，是否要替换？',function(){
                      params['confirm'] = 1;
                      layerFn.submit(urlUserAdd,params,function(result){
                        thisPage.complete(result,layerIndex,true);
                      });
                    });
                    break;
                  default:
                    layerFn.alert(data.msg,data.code);
                    break;
                }
              });
            });
            thisPage.resetForm();
            winFn.chosenOption('form_chosen_select','请输入关键字搜索',(row.user_id) ? row.user_id : null);//编辑时赋值先执行此行,注意第2个参数;再执行winFn.chosenDisplay,注意第3个参数的值与本chosenOption方法的第3个参数的值要一致
            if(row.user_id){
              $.each(row,function(k,v){
                try{
                  if(k == 'user_id'){
                    winFn.chosenDisplay('form_chosen_select',row.user_name+' '+row.real_name,row.user_id);//编辑时赋值再执行此行,注意本方法的第3个参数的值要与 winFn.chosenOption 方法的第3个参数的值要一致!!!;第2个参数是显示的文字,第3个参数是赋值,把value赋值给select的id为第1个参数赋值
                    return true;
                  }
                  $('#' + k).val(v);
                }catch(e){}
              });
            }
            if(row.province_name){//编辑时
              layerFn.queryGetHintResult(urlGetListArea,{province_id:row.province_id,city_id:row.city_id,selected:1},function(data){
                if(AppKey.code.code200 == data.code){//仅处理code=200
                  var resultData = data.data;
                  pulldownArea.fillLabelValue('#div_proxy_area','clsProvince',row.province_id);//省级
                  pulldownArea.fillLabelValue('#div_proxy_area','clsCity',row.city_id,urlGetListArea,jsonArea,resultData.city_id);//市级
                  pulldownArea.fillLabelValue('#div_proxy_area','clsCounty',row.county_id,urlGetListArea,jsonArea,resultData.county_id);//区|县
                }
              });
              pulldownArea.showPullDown('#div_proxy_area',row);//防止请求失败及防止code!=200时的兜底回写(仅执行1次，因为上面的是方法体，不会因为顺序执行再执行到此行了)
            }
          }
        });
      },
      //查看隐藏部分是全部内容,用法 render : function(value,type,row,meta){return thisPage.rowColumnView(value);}
      rowColumnView : function(value){
        if(value == null || value == undefined || value == '') return '';
        value = typeof value === 'string' ? value.replace(/</g, '&lt;').replace(/"/g, '&quot;') : value;//如果提示SyntaxError: expected expression, got '>'错误则注释掉即可
        var len = value.length;
        if(len > 30){
          return "<a href='javascript:layerFn.viewValue(\""+value+"\",\"430px\");' title='点击查看详情' style='outline:none;text-decoration:none;'>"+value.substring(0,30)+"…</a>";
        }else{
          return value;
        }
      },
      complete: function(data,index,search){
        try{
          if(index){
            layerFn.closeIndex(index);
          }
          if(search){
            thisPage.search();
          }
          if(data){
            layerFn.handleResult(data.msg,data.code);
          }
        }catch(e){}
      }
    };
    thisPage.init();
    $('script').remove();
  })(jQuery);
</script>